import request from "@/lib/utils/request";
import { Response, PaginationType, ResponseWithPagination } from "../common";
import { Config } from "./config.d";

export const getConfigListApi = (
  params: PaginationType,
): ResponseWithPagination<Config> => {
  return request.get("/system/config/list", { params });
};

export const addConfigApi = (data: Config): Response<null> => {
  return request.post("/system/config", data);
};

export const updateConfigApi = (data: Config): Response<null> => {
  return request.put("/system/config", data);
};

export const deleteConfigApi = (configId: string): Response<null> => {
  return request.delete(`/system/config/${configId}`);
};

export const getConfigApi = (configId: string): Response<Config> => {
  return request.get(`/system/config/${configId}`);
};
